<?php
namespace app\erp\controller;
use app\erp\model\Shoppingdb;
class Shopping extends Base{
    protected $db;
    public $post = array();
    public function _initialize()
    {
        parent::_initialize();
        $request = request();
        $param = $request->param();
        $this->post = $param;
        $this->db = new Shoppingdb();
        $this->db->param = $this->post;
    }
    public function ajaxList()
    {
        $return = $this->db->ajaxSelect();
        $this->layuiReturn($return['data'], $return['count']);
    }
    public function ajaxFind(){
        $return = $this->db->ajaxFind($this->post['shopping_id']);
        $this->layuiReturn($return, 1);
    }
    public function saveData()
    {
        $return = $this->db->ajaxSave();
        if ($return != 'success') {
            $this->layuiReturn($return, 0, $return, - 1);
        } else {
            $this->layuiReturn('保存成功');
        }
    }
}